package com.streetsmart;
/**
 * 
 * @author bhavani sudha
 *
 */
import org.json.JSONException;
import com.streetsmart.Utilities;
/**
 * stores the location of objects
 */


public class MyLocation {
	private double latitude;
	private double longitude;
	private String address;
	
	public MyLocation(double latitude, double longitude) throws JSONException {
		this.latitude = latitude;
		this.longitude = longitude;
		double[] geocodes = new double[2];
		geocodes[0] = latitude;
		geocodes[1] = longitude;
		this.address = Utilities.getAddress(geocodes); 
	}
	
	public MyLocation(String address) throws JSONException{
		this.address = address;
		double[] geocodes;
		geocodes = Utilities.getLatAndLng(address);
		this.latitude = geocodes[0];
		this.longitude = geocodes[1];
	}
	
	public MyLocation(double latitude, double longitude, String address){
		this.latitude = latitude;
		this.longitude = longitude;
		this.address = address;
	}
	
	/**
	 * @return the latitude
	 */
	public double getLatitude() {
		return latitude;
	}
	
	/**
	 * @param latitude: the latitude to set
	 */
	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}
	
	/**
	 * @return the longitude
	 */
	public double getLongitude() {
		return longitude;
	}
	
	/**
	 * @param longitude : the longitude to set
	 */
	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}
	
	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}
	
	/**
	 * @param address: the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}	
}
